<?php
//$str=$_POST['src'];
error_reporting(E_ALL);

if ($mode == NULL) {
   ?>
   <form name="test" method="POST" action="./test.php?mode=work">
   <textarea name="stuff" rows="20" cols="60"></textarea><br />
   <input type="submit" value="Submit">
   </form>
   <?php
}
elseif ($mode == "work") {

$stuff = $_POST['stuff'];
$stuff = str_replace("\'", "'", $stuff);
$stuff = str_replace('\"', '"', $stuff);
$str = str_replace("\r", null, $stuff);

//echo $str;
//echo "<br /><br />";

$strexp = explode("\n \n",$str);

$tit_cat_ser=$strexp[1];
$ingred=$strexp[2];
$direct=$strexp[3];
//$notes=$strexp[4];

$tit_cat_ser_exp=explode("\n",$tit_cat_ser);

$title=$tit_cat_ser_exp[0];
$cat=$tit_cat_ser_exp[1];
$serv=$tit_cat_ser_exp[2];

echo str_replace("Title: ", "" , $title);
echo "<br />";
echo str_replace("Categories: ", "" , $cat);
echo "<br />";
echo str_replace("Yield: ", "" , $serv);
echo "<br /><br />";
echo nl2br($ingred);
echo "<br /><br />";
echo nl2br($direct);
echo "<br /><br />";
/*if ($notes != "MMMMMM"){
   echo nl2br($notes);
}*/

/*echo $str[0];
echo "<br />";
echo $str[1];
echo "<br />";
echo $str[2];
echo "<br />";
echo $str[3];
echo "<br />";*/

/*echo $tit_cat_ser[0];
echo "<br />";
echo $tit_cat_ser[1];
echo "<br />";
echo $tit_cat_ser[2];
echo "<br />";
echo $tit_cat_ser[3];
echo "<br />";
echo $tit_cat_ser[4];
echo "<br />";*/

}

else {
echo "Error unknow mode";
}
?>